<!DOCTYPE html>
<html lang="zxx">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">

	<link rel="icon" href="images/favicon.png">
	<title></title>

   <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="stylesheet" href="css/materialize.css">
    <link rel="stylesheet" href="css/loaders.css">
    <link rel="stylesheet" href="css/lightbox.css">
    <link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/font-awesome.4.6.0.css">
    <link rel="stylesheet" href="css/owl.carousel.min.css">
    <link rel="stylesheet" href="css/owl.theme.default.min.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/layer.css">

</head>
<body>
	
	<!-- navbar -->
	<div class="navbar">
		<div class="container">
			<div class="row">
				<div class="col s9">
					<div class="content-left" onclick="javascript:history.back(-1);">
                   <i class="fa fa-chevron-left center"></i>
					</div>
				</div>
				
			</div>
		</div>
		
	</div>
	<!-- end navbar -->
	
	<!-- sidebar -->
	
	<!-- end sidebar -->

	<!-- list -->
	<div class="list segments-page">
		<div class="pages-title">
			<h3>团队成员</h3>
			<div class="line"></div>
		</div>
		<div class="container" id="container" >
			
		</div>
	</div>
	<!-- end list -->

<script src="js/jquery.min.js"></script>
<script src="js/materialize.js"></script>
<script src="js/numscroller.js"></script>
<script src="js/lightbox.js"></script>
<script src="js/owl.carousel.min.js"></script>
<script src="js/main.js"></script>
<script src="js/layer.js"></script>
<script src="js/jquerysession.js"></script>
<script src="http://www.gongjuji.net/Content/files/jquery.md5.js"></script>
<script src="js/index.js"></script>
<script>

	$(document).ready(function () {

	
	    var Teamurl = 'Member/team';
	    var TeamInfo = api_request(Teamurl, 'GET');
	    if(TeamInfo.code==1){
		var html = "";
		var data=TeamInfo.data.data;
		
			if(data){
				for(var i=0;i<data.length;i++){
					 var ls=data[i];
				
					if(ls.headpic==''){
						ls.headpic='images/bag-imgB.jpg';
					}
					if(ls.gcode==1){
						Activation="<button class='button z-depth-1' onclick='activation("+ls.id+");'>激活会员 </button>"
					}else{
						Activation="<button class='button z-depth-1' >已激活 </button>"
					}
					 html="<div class='contents'><div class='list-img'><img src='"+ls.headpic+"'alt=''></div><div class='list-text'><h6>用户名:"+ls.username+"</h6><p>注册时间:"+ls.register_time+"</p><p>会员状态:"+ls.gname+"</p> <p>"+Activation+"</p></div></div></div>"
					   $('#container').append(html);
				}
			}else{
				html="<p style='text-align:  center;'>暂未有下级</p>"
				$('#container').append(html);
			}
	}
	 }); 
	 
	function  activation(pid){
	
			var Activationmurl = 'Member/Activation?pid=' + pid;
			  var user_id = $.session.get('user_id');
			var ActivationmInfo = api_request(Activationmurl, 'GET');
			console.log(ActivationmInfo)
			if(ActivationmInfo.code==1){
				layer.open({
				    content: ActivationmInfo.data
				    , skin: 'msg'
				    , time: 2,//2秒后自动关闭
					 end:function () {
					        location.reload()
					    }
				 
				});
			}
			if (ActivationmInfo.code == 3) {
				  layer.open({
				    content: ActivationmInfo.data
				    ,btn: ['立即激活', '稍后激活']
				    ,yes: function(index){
				      var Currenturl = 'Member/ActivationUser?user_id=' + user_id;
					  var CurrentInfo = api_request(Currenturl, 'GET');
					  if(CurrentInfo.code==1){
						  layer.open({
						    content: CurrentInfo.data
						    , skin: 'msg'
						    , time: 2 //2秒后自动关闭
						  });
					  }
				    }
				  });
			}
		
		 }
</script>
</body>
</html>